package com.zdxlz.fcmp.common.core.constant.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @description：登陆状态枚举
 * @author：aman
 * @date：2025/3/7 13:42
 */
@Getter
@AllArgsConstructor
public enum LoginStatusEnums {

    SUCCESS(true, "成功"),

    FAILED(false, "失败"),
    ;

    @EnumValue
    private final Boolean code;
    private final String name;

    public static LoginStatusEnums getByCode(Boolean code) {
        for (LoginStatusEnums statusEnums : LoginStatusEnums.values()) {
            if (statusEnums.getCode().equals(code)) {
                return statusEnums;
            }
        }
        return null;
    }

    @JsonValue
    public Boolean getCode() {
        return code;
    }

}
